<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <title>新增房间</title>
 	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	
	<link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/vivo.css">
    <link rel="stylesheet" href="css/cmxform.css">
	
	<script src="js/jquery-1.11.1.js"></script>
	<link href="js/select2/select2.min.css" type="text/css" rel="stylesheet" />
	<link rel="stylesheet" href="js/uploadify/uploadify.css" type="text/css">
	<script type="text/javascript" src="js/uploadify/jquery.uploadify.min.js"></script>
	<script type="text/javascript" src="js/form.js"></script>
	<script src="js/select2/select2.min.js"></script>
    <script src="js/jquery.validation/1.14.0/jquery.validate.min.js"></script>
    <script src="js/jquery.validation/1.14.0/messages_zh.min.js"></script>
    <script type="text/javascript" src="js/layer/layer/layer.js"></script> 
	<script language="javascript" type="text/javascript" src="<%=basePath %>js/My97DatePicker/WdatePicker.js"></script>
	<link rel="stylesheet" href="js/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    <script type="text/javascript" src="js/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script>
    <script type="text/javascript" src="js/sharefunction.js"></script>
	
	

	<script type="text/javascript">
		
		
		$(document).ready(function() {
			initUploadMulti("<%=basePath %>");
		});
		function saveDocument(){
			var ss=$('#uploadifyInfo').children().length;
			if(ss>4){
				layer.alert("只能选择一个Excel文件",{icon:7});
				return false;
			}
			//layer.confirm("确定保存吗？",{icon:3},function(i){
			//loading层
			layer.msg('处理中，请稍后...', {icon: 16});
			var id=$("#id").val();
			var buildingInfoId = $("#buildingInfoId").val();
				var url="project/roomInfo/Add2";
				jQuery.ajax({
				    type:"post",
				    async:false,
				    url:url,
			        dataType:"json",
			        data:{
			        	id:id,
						buildingInfoId:buildingInfoId
			        },
				    success:function(responseText){
				        if(responseText.success){
							window.parent.gridObj.refreshPage();
				        	window.parent.layer.msg('保存成功！');
				        	closeLayer();
		    			}else{
		    				window.parent.layer.alert(responseText.msg, {icon: 7});
		    				closeLayer();
		    			}
				    }
		   		});
			//});
		
		}
		
	</script>

	</head>
	<body>
		<div class="page-container">
		<form class="cmxform" id="commentForm" method="get" action="" enctype="multipart/form-data">
		<div style="padding:0px">
		
		<div class="panel panel-default">
			<div class="panel-heading">
      				<h5 class="panel-title">Excel表批量新增单元信息</h5>
   			 </div>
   			<div class="panel-body">
			<table cellpadding="10" cellspacing="5" class="mytable">
					<tr>
						<td width="90" ><b>所属楼栋</b></td>
						 <td width="340">
						 		<b>${buildingInfo.buildingName }</b>
						 		<input type="hidden" name="buildingInfoId" id="buildingInfoId" value="${buildingInfo.id }">
						</td>
					   
					    <td width="90">所属楼盘</td>
						<td width="310">
							<b>${buildingInfo.projectInfo.projectName }</b>
							<span></span>
						</td>
					</tr>
				
			</table>
			<input class="uploadify" attType="file1" id="uploadify" name="uploadify"  type="file"/>
			<span id="uploadifyInfo" attType="file1"></span>
			</div>
			</div>
			<div style="width:100%;text-align:center; padding-top:20px"> 
				<button class="btn btn-primary radius" onClick="saveDocument();"  > 保 存</button> 
				 <a class="btn btn-default radius" onClick="closeLayer();"> 取 消 </a> 
		    	  <br/><br/>
	    	</div> 
		</div>
		
		</form>
		<div style="display:none">
	    	<input id="id" name="id" type="hidden" value="${id} "/>
	    </div>
	    </div>
		<jsp:include page="/upload-field.jsp"></jsp:include>
  	</body>
  	
   </html>
  	
